layui.use(['table', 'admin', 'ax', 'func'], function () {
    var $ = layui.$;
    var table = layui.table;
    var $ax = layui.ax;
    var admin = layui.admin;
    var func = layui.func;


    /**
     * 数据质量检查详情表管理
     */
    var QualityCheckDetail = {
        tableId: "qualityCheckDetailTable"
    };

    /**
     * 初始化表格的列
     */
    QualityCheckDetail.initColumn = function () {
        return [[
            {type: 'checkbox', hide: true},
            {field: 'dataQualityCheckDetailId', hide: true, title: '数据质量检查详情id'},
            {field: 'dataQualityCheckId', sort: false, title: '数据质量检查id', hide: true},
            {field: 'problemColumnName', sort: false, title: '问题字段', align: "center"},
            {field: 'problemColumnDetail', sort: false, title: '问题字段数据', align: "center"},
            {field: 'isDelete', sort: false, title: '是否删除;0代表删除;1代表可用', hide: true},
            {align: 'center', toolbar: '#tableBar', title: '操作', hide: true}
        ]];
    };

    $("#returnBefore").click(function () {
        history.go(-1)
    })

    $("#reset").click(function () {
        $("#problemColumnName").val("")
        QualityCheckDetail.search()
    })

    /**
     * 点击查询按钮
     */
    QualityCheckDetail.search = function () {
        var queryData = {};

        queryData['problemColumnName'] = $("#problemColumnName").val()

        table.reload(QualityCheckDetail.tableId, {
            where: queryData, page: {curr: 1}
        });
    };


    // 渲染表格
    var tableResult = table.render({
        elem: '#' + QualityCheckDetail.tableId,
        url: Feng.ctxPath + '/qualityCheckDetail/list?dataQualityCheckId=' + Feng.getUrlParam("dataQualityCheckId"),
        page: true,
        height: "full-158",
        cellMinWidth: 100,
        skin: "line",
        cols: QualityCheckDetail.initColumn(),
        done: function (res, curr, count) {
            $('tr').css('background-color', '#ffffff')
        }
    });

    // 搜索按钮点击事件
    $('#btnSearch').click(function () {
        QualityCheckDetail.search();
    });

});
